<#include "/common/head.ftl">

</script>

<@showTitle title="${i18n.getMessage('attendance')} > ${i18n.getMessage('check')}">
	<a href="#" onclick="cc('offering/showInfoAttendance.sgt?offeringId=${offering.id}')">${i18n.getMessage('attendance')}</a>
	- <a href="#" onclick="cc('offering/showInfoOffering.sgt?id=${offering.id}')">${i18n.getMessage('offering')}</a>
</@showTitle>

<div id="error" style="display:none"></div>

<form action="offering/editAttendance.sgt" validator="offering/validateAttendance.sgt" onsubmit="submitFormValidation(this); return false;" onreset="$('error').hide()">
	<input type="hidden" name="offeringId" value="${offering.id}"/>
	
	<table id="dataTable" align="center" cellspacing="5" cellpadding="0">
		<tr>
			<td class="name" style="vertical-align:top">${i18n.getMessage('allStudents')}:</td>
			<td>
				<select name="memberIds" style="width:205px" multiple size="10">
					<#list offeringMembers as member>
						<#assign index = member_index + 1>
						<option value="${member.id}" <#if (member = (offeringMember)!)>selected</#if>><#if (index < 10)>&nbsp;&nbsp;</#if>${index}. ${(member.receipt.student.lastName)!} ${(member.receipt.student.firstName)!}</option>
					</#list>
				</select> 
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('fromDate')}:</td>
			<td><input type="text" name="fromDate" value="${(selectedDate?date)!}" style="width:200px"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].fromDate, '${i18n.getMessage('format.date')}', this)"/></td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('toDate')}:</td>
			<td><input type="text" name="toDate" style="width:200px"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].toDate, '${i18n.getMessage('format.date')}', this)"/></td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('status')}:</td>
			
			<td>
				<input type="radio" name="status" value="NONE" checked/>${i18n.getMessage('attendance.long.none')}
				<input type="radio" name="status" value="PRESENT" <#if 'PRESENT'=(offeringMember.getAttendance(selectedDate).status)!>checked</#if> />${i18n.getMessage('attendance.long.present')}
				<input type="radio" name="status" value="ABSENT" <#if 'ABSENT'=(offeringMember.getAttendance(selectedDate).status)!>checked</#if> />${i18n.getMessage('attendance.long.absent')}
			</td>
		</tr>
		<tr>
			<td class="name" style="vertical-align:top">${i18n.getMessage('comment')}:</td>
			<td><textarea name="comment" style="width:350px;height:80px;">${(offeringMember.getAttendance(selectedDate).comment)!}</textarea></td>
		</tr>
		<tr>
			<td class="name"></td>
			<td>
				<input type="submit" value="${i18n.getMessage('edit')}" class="button_style"/> 
				<input type="reset" value="${i18n.getMessage('reset')}" class="button_style"/> 
			</td>
		</tr>
	</table>
</form>